package entity.fuxi.demo02;

import entity.fuxi.Student;

import java.lang.reflect.Method;
import java.util.Scanner;

public class MainTest {
    public static void main(String[] args)throws Exception{
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入一个年份");
        int year = sc.nextInt();
        Class<?> clzz = Student.class;
        Method method = clzz.getMethod("isYeas", int.class);
        boolean invoked = (boolean) method.invoke(null, year);
        if (invoked){
            System.out.println(year + " 年是闰年。");
        } else {
            System.out.println(year + " 年是平年。");
        }
    }
}
